package cn.jiyun;

import com.mongodb.MongoClient;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
import org.bson.Document;

public class MongoDemo5 {
    public static void main(String[] args) {
        //创建连接
        MongoClient client = new MongoClient("127.0.0.1");
        //打开数据库
        MongoDatabase spitdb = client.getDatabase("spitdb");
        //获取集合
        MongoCollection<Document> split = spitdb.getCollection("spit");
        //删除
        split.deleteOne(Filters.eq("_id","1"));
        //关闭连接

        client.close();
    }
}
